<#include "/includes/vars.inc">  
<@pp.dropOutputFile />
<#list entities.entity as entity>
	<#if !entity.@parent[0]??>
	    <@pp.changeOutputFile name="${webDir}/jeecode/"+entity.@name?uncap_first+"/"+entity.@name?cap_first+"Manage.xhtml" />
	    <#assign entityName = entity.@name>
	    <#assign managedBean = entity.@name?uncap_first+"Controller">
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template.xhtml">
    	<ui:define name="body">
            <p:panel header="${r"#{"}msg.${entityName?uncap_first}Manage${r"}"}">   
            <#if entity.@singleton="false">            
                <h:form id="form${entityName}List">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}List.xhtml"/>
                </h:form>
                <h:form id="form${entityName}Create">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}Create.xhtml" />
                </h:form>
                <h:form id="form${entityName}Edit">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}Edit.xhtml" />
                </h:form>
                <h:form id="form${entityName}Delete">
                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}Delete.xhtml"/>
                </h:form>
              <#else>
               <h:form id="form${entityName}Edit">
                    <p:messages id="errors" redisplay="false" />
			            <h:panelGroup id="data">
			                <h:panelGrid columns="2" cellpadding="5">
			                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}DataEdit.xhtml" />
			                </h:panelGrid>
			                 <p:separator />
	                        <p:spacer height="5" />  
	                        <p:commandButton update="errors,data"
	                                         actionListener="${r"#{"}${managedBean}.save${r"}"}"
	                                         value="${r"#{"}msg.save${r"}"}"
	                                         icon="ui-icon ui-icon-disk" />
			            </h:panelGroup>
                </h:form>
              </#if>
            </p:panel>  
    	</ui:define>
    </ui:composition>
</html>
	</#if>
</#list>